home *** CD-ROM | disk | FTP | other *** search
- Path: gollum.kingston.net!usenet
- From: girard@haventree.com (Eugene Girard)
- Newsgroups: comp.lang.c++
- Subject: Re: sscanf alternative in C++
- Date: Wed, 03 Apr 1996 21:14:59 GMT
- Organization: HavenTree Software, Limited
- Message-ID: <4jut92$kbo@gollum.kingston.net>
- References: <4jt589$fl0@mirv.unsw.edu.au>
- NNTP-Posting-Host: buddy.haventree.com
- X-Newsreader: Forte Free Agent v0.55
-
- jeroen@fatboy.gas.unsw.edu.au (Jeroen Dijkmeijer) wrote:
-
- >Hello,
-
- >is there a nice way in C++ to have a function like the sscanf function in C.
- >e.g. specify the string and a pointer to the target, and as a result of the function, the status whether it succeeded or not.
-
- Yes, C++ fully supports <stdarg.h>, with which you could write:
-
- #include <stdarg.h>
- int MySScanF( char *buffer, const char *fmt, ...)
- {
- va_list argptr;
- int cnt;
-
- va_start(argptr, fmt);
- cnt = vsscanf(buffer, fmt, argptr);
- va_end(argptr);
-
- return(cnt);
- }
-
- >Thanks in advance.
- >regards
- >Jeroen.
-
- (Or you could use the sscanf() function itself....)
- Gene
-
-
-
- --
- Eugene Girard, Programmer, HavenTree Software Limited
- HavenTree makes EasyFlow (Windows, DOS, MAC) and Nodemap (Windows, DOS)
- For more information, check out http://www.haventree.com
-
-